package es.us.isa.jdbl.domain;


import java.util.List;
import java.util.Set;

import javax.persistence.*;




@Entity
@SecondaryTables({
	@SecondaryTable(name="content_type_project", catalog = "webisa", pkJoinColumns={
			@PrimaryKeyJoinColumn(name="nid", referencedColumnName="nid")}),
	@SecondaryTable(name="content_field_acronym", catalog = "webisa", pkJoinColumns={
			@PrimaryKeyJoinColumn(name="nid", referencedColumnName="nid")}),
	@SecondaryTable(name="content_field_amount", catalog = "webisa", pkJoinColumns={
			@PrimaryKeyJoinColumn(name="nid", referencedColumnName="nid")}),
	@SecondaryTable(name="content_field_amount_detail", catalog = "webisa", pkJoinColumns={
			@PrimaryKeyJoinColumn(name="nid", referencedColumnName="nid")}),
	@SecondaryTable(name="content_field_startdate", catalog = "webisa", pkJoinColumns={
			@PrimaryKeyJoinColumn(name="nid", referencedColumnName="nid")}),
	@SecondaryTable(name="content_field_end_date", catalog = "webisa", pkJoinColumns={
			@PrimaryKeyJoinColumn(name="nid", referencedColumnName="nid")}),
	@SecondaryTable(name="content_field_research_detail", catalog = "webisa", pkJoinColumns={
			@PrimaryKeyJoinColumn(name="nid", referencedColumnName="nid")}),
	@SecondaryTable(name="content_field_idi", catalog = "webisa", pkJoinColumns={
			@PrimaryKeyJoinColumn(name="nid", referencedColumnName="nid")}),
	@SecondaryTable(name="content_field_status", catalog = "webisa", pkJoinColumns={
			@PrimaryKeyJoinColumn(name="nid", referencedColumnName="nid")}),	
			
})
//@Table(name="content_type_project")
@DiscriminatorValue("project")
public class Project extends AbstractNode{
	
	@Column(name="field_acronym_value", table="content_field_acronym")
	private String acronym;
	//content_field_acronym
	
	@Column(name="field_code_value", table="content_type_project")
	private String code;
	//content_type_project

	@Column(name="field_organic_value", table="content_type_project")
	private String organic;
	//content_type_project

	@Column(name="field_amount_value", table="content_field_amount")
	private Float amount;
	//content_field_amount
	
	@Column(name="field_amount_requested_value", table="content_type_project")
	private String amountRequested;
	//content_type_project	

	@Column(name="field_amount_detail_value", table="content_field_amount_detail")
	private String amountDetail;
	//content_field_amount_detail
	
	@Column(name="field_startdate_value", table="content_field_startdate")
	private String startDate;
	//content_field_startdate
	
	@Column(name="field_end_date_value", table="content_field_end_date")
	private String endDate;
	//content_field_end_date
	
	@Column(name="field_research_detail_value", table="content_field_research_detail")
	private String researchDetail;
	//content_field_research_detail
	
	@Column(name="field_idi_value", table="content_field_idi")
	private Boolean idi;
	//content_field_idi
	
	@Column(name="field_status_value", table="content_field_status")
	private String statusISA;
	//content_field_status
	
	@ManyToOne
	@JoinTable(name="content_field_organization", catalog = "webisa",
			joinColumns=@JoinColumn(name="nid"),
			inverseJoinColumns=@JoinColumn(name="field_organization_nid"))
	private Organization financialOrganization;
	
	@OneToOne
	@JoinTable(name="term_node", catalog = "webisa",
			joinColumns=@JoinColumn(name="nid"),
			inverseJoinColumns=@JoinColumn(name="tid"))
	private Term tipoConvocatoria;
	
	@ManyToMany
	@JoinTable(name="content_field_organization_participating", catalog = "webisa",
			joinColumns=@JoinColumn(name="nid"),
			inverseJoinColumns=@JoinColumn(name="field_organization_participating_nid"))
	private List<Organization> participatingOrganization;

	@ManyToOne
	@JoinTable(name="content_field_coordinator", catalog = "webisa",
			joinColumns=@JoinColumn(name="nid"),
			inverseJoinColumns=@JoinColumn(name="field_coordinator_uid", referencedColumnName="uid"))
	private Member coordinator;
	
	@ManyToOne
	@JoinTable(name="content_field_coordinator_univsevilla", catalog = "webisa",
			joinColumns=@JoinColumn(name="nid"),
			inverseJoinColumns=@JoinColumn(name="field_coordinator_univsevilla_uid", referencedColumnName="uid"))
	private Member coordinatorUnivSevilla;
	
	@ManyToMany
	@JoinTable(name="content_field_user", catalog = "webisa",
			joinColumns=@JoinColumn(name="nid"),
			inverseJoinColumns=@JoinColumn(name="field_user_uid", referencedColumnName="uid"))
	private List<Member> researchStaff;
	
	@ManyToMany
	@JoinTable(name="content_field_user_technical", catalog = "webisa",
			joinColumns=@JoinColumn(name="nid"),
			inverseJoinColumns=@JoinColumn(name="field_user_technical_uid", referencedColumnName="uid"))
	private List<Member> technicalStaff;


//content_field_coordinator_univsevilla

	
	
	
	public String getAcronym() {
		return acronym;
	}

	public void setAcronym(String acronym) {
		this.acronym = acronym;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getOrganic() {
		return organic;
	}

	public void setOrganic(String organic) {
		this.organic = organic;
	}

	public Float getAmount() {
		return amount;
	}

	public void setAmount(Float amount) {
		this.amount = amount;
	}

	public String getAmountRequested() {
		return amountRequested;
	}

	public void setAmountRequested(String amountRequested) {
		this.amountRequested = amountRequested;
	}

	public String getAmountDetail() {
		return amountDetail;
	}

	public Member getCoordinator() {
		return coordinator;
	}

	public void setCoordinator(Member coordinator) {
		this.coordinator = coordinator;
	}

	public void setAmountDetail(String amountDetail) {
		this.amountDetail = amountDetail;
	}

	public String getStartDate() {
		return startDate;
	}

	public void setStartDate(String startDate) {
		this.startDate = startDate;
	}

	public String getEndDate() {
		return endDate;
	}

	public void setEndDate(String endDate) {
		this.endDate = endDate;
	}

	public String getResearchDetail() {
		return researchDetail;
	}

	public void setResearchDetail(String researchDetail) {
		this.researchDetail = researchDetail;
	}

	public Boolean getIdi() {
		return idi;
	}

	public void setIdi(Boolean idi) {
		this.idi = idi;
	}

	public String getStatusISA() {
		return statusISA;
	}

	public void setStatusISA(String statusISA) {
		this.statusISA = statusISA;
	}

	public Organization getFinancialOrganization() {
		return financialOrganization;
	}

	@Override
	public String toString() {
		return "Project [acronym=" + acronym + ", coordinator=" + coordinator
				+ ", getTitle()=" + getTitle() + "]";
	}

	public void setFinancialOrganization(Organization financialOrganization) {
		this.financialOrganization = financialOrganization;
	}

	public List<Organization> getParticipatingOrganization() {
		return participatingOrganization;
	}

	public void setParticipatingOrganization(
			List<Organization> participatingOrganization) {
		this.participatingOrganization = participatingOrganization;
	}

	public void setTipoConvocatoria(Term tipoConvocatoria) {
		this.tipoConvocatoria = tipoConvocatoria;
	}

	public Term getTipoConvocatoria() {
		return tipoConvocatoria;
	}

	public List<Member> getResearchStaff() {
		return researchStaff;
	}

	public void setResearchStaff(List<Member> researchStaff) {
		this.researchStaff = researchStaff;
	}

	public List<Member> getTechnicalStaff() {
		return technicalStaff;
	}

	public void setTechnicalStaff(List<Member> technicalStaff) {
		this.technicalStaff = technicalStaff;
	}

	public Member getCoordinatorUnivSevilla() {
		return coordinatorUnivSevilla;
	}

	public void setCoordinatorUnivSevilla(Member coordinatorUnivSevilla) {
		this.coordinatorUnivSevilla = coordinatorUnivSevilla;
	}
	
}
